/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-04-28 09:51:47
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-06-06 15:55:06
 * @FilePath: \cxl-h5\src\apis\refund\index.ts
 */
import { request as axios } from '@/axios/index'

export interface refundInterface {
    bankAccount: string //	银行账号
    branches: string //开户网点
    brank: string //收款银行
    companyId: string //企业id
    description: string //备注说明
    id?: string //id
    phone: string //手机号
    receiverName: string //收款人姓名
    refundReason: number //退款理由（1.购买错误；2.报告数据不准；3.不合适；4.其他）
    remainAmount: string //钱包余额
}

/**
 * 退款申请
 * @param data
 * @param bankAccount?: string //	银行账号
 * @param branches?: string //开户网点
 * @param brank?: string //收款银行
 * @param companyId?: string //企业id
 * @param description?: string //备注说明
 * @param id?: string //id
 * @param phone?: string //手机号
 * @param receiverName?: string //收款人姓名
 * @param refundReason?: number //退款理由（1.购买错误；2.报告数据不准；3.不合适；4.其他）
 * @param remainAmount?: string //钱包余额
 * @returns
 */
export const refundApplyFor = (data: refundInterface) => {
    return axios({
        method: 'post',
        url: '/api/mall/company/refund/submit-refund',
        data
    })
}

export const getPrevRefundInfo = () => {
    return axios({
        method: 'get',
        url: '/api/system/company/bankAccount/findByCompanyId'
    })
}

/**
 * 计算企业退款金额
 * @param id
 * @returns
 */
export const calculateRefundAmount = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/mall/company/store/calculate-refund-amount',
        params: { id }
    })
}

/**
 * 企业退款记录
 * @param current
 * @param size
 * @returns
 */
export const refundRecordList = () => {
    return axios({
        method: 'get',
        url: '/api/mall/company/refund/recordList'
    })
}

/**
 * 退款详情
 * @param storeRefundId
 * @returns
 */
export const refundOrderDetailed = (storeRefundId: string) => {
    return axios({
        method: 'get',
        url: '/api/mall/company/refund/refund-detail',
        params: { storeRefundId }
    })
}
